//
//  BFShOrderHomeViewController.m
//  BeautyFood
//
//  Created by apple on 2020/5/5.
//  Copyright © 2020 stoneobs. All rights reserved.
//

#import "BFAfterSaleProcessViewController.h"
#import "BFShOrderHeaderView.h"
#import "BFShOrderTableViewCell.h"
#import "BFShOrderFooterView.h"
#import "BFShOrderDetailViewController.h"
#import "BFApplyAfterSaleViewController.h"
#import "STTools_TextView.h"
#import "BFShAfterSaleModel.h"
@interface BFAfterSaleProcessViewController ()<STBWBrowserViewControllerDelegate>
@property(nonatomic, strong) NSMutableArray                     *dataSouce;/**<  */
@property(nonatomic, strong) NSMutableArray                     *imageArray;/**<  */
@property(nonatomic, strong) BFShAfterSaleModel                     *afterSaleModel;/**<  */
@property(nonatomic, strong) UITextField                     *postTextFiled;/**<  */
@end

@implementation BFAfterSaleProcessViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"售后进度";
    [self send_after_sale_detail_request];
    [self stoneobs_fun_st_autoAdjustAllResponder];
    // Do any additional setup after loading the view.
}
#pragma mark --configSubView
- (void)BeautyFood_ui_configSubView{

    
    self.tableView.frame = CGRectMake(0, TMUtils.stoneobs_fun_get_navgationBarBootom, STONEOBS_UI_UISCREEN_WIDTH, TMUtils.stoneobs_fun_get_tabBarTop+49 - TMUtils.stoneobs_fun_get_navgationBarBootom);
    self.tableView.contentInset = UIEdgeInsetsZero;
    
    [self.tableView registerClass:BFShOrderHeaderView.class forHeaderFooterViewReuseIdentifier:@"BFShOrderHeaderView"];
    [self.tableView registerClass:BFShOrderTableViewCell.class forCellReuseIdentifier:@"BFShOrderTableViewCell"];
    [self.tableView registerClass:BFShOrderFooterView.class forHeaderFooterViewReuseIdentifier:@"BFShOrderFooterView"];
    

}
- (void)config_tableFooter{
    UIView * footer = [[UIView alloc] initWithFrame:STONEOBS_UI_UISCREEN_FRAME];
    
    CGFloat top = 10;
    ({
        UIView * whiteView = [[UIView alloc] initWithFrame:CGRectMake(12, top, STONEOBS_UI_UISCREEN_WIDTH - 24, 156)];
        whiteView.backgroundColor = UIColor.whiteColor;
        whiteView.layer.cornerRadius = 8;
        whiteView.clipsToBounds = YES;
        [footer addSubview:whiteView];
        top = whiteView.bottom + 15;
        
        UIView * subHeader = [TMUtils stoneobs_fun_titleButtonViewWithTile:@"情况描述" showRightGo:NO handle:nil];
        [whiteView addSubview:subHeader];
        
        STLabel * BeautyFood_ui_label = [[STLabel alloc] initWithFrame:CGRectMake(24,subHeader.bottom, whiteView.width - 48, 20)
                                                                text:self.afterSaleModel.reason
                                                           textColor:STMC_UICOLOR_FROM_RGBA(0x5C5C5C)
                                                                font:13
                                                         isSizetoFit:NO
                                                       textAlignment:NSTextAlignmentLeft];
        [NSString stoneobs_fun_lableAutoAdjustheightWithLabel:BeautyFood_ui_label];
        [whiteView addSubview:BeautyFood_ui_label];
        whiteView.height = BeautyFood_ui_label.bottom + 20;
        top = whiteView.bottom + 10;
    });
    
    ({
        UIView * whiteView = [[UIView alloc] initWithFrame:CGRectMake(12, top, STONEOBS_UI_UISCREEN_WIDTH - 24, 156)];
        whiteView.backgroundColor = UIColor.whiteColor;
        whiteView.layer.cornerRadius = 8;
        whiteView.clipsToBounds = YES;
        [footer addSubview:whiteView];
        
        
        UIView * subHeader = [TMUtils stoneobs_fun_titleButtonViewWithTile:@"现场图片" showRightGo:NO handle:nil];
        [whiteView addSubview:subHeader];
        
        CGFloat temp_top = subHeader.bottom -10;
        __weak typeof(self) weakSelf =  self;
        CGFloat inset = 5;
        CGFloat witdh = (whiteView.width - 24 * 2 - inset * 3) / 4;
        self.imageArray = NSMutableArray.new;
        for (NSInteger i = 0; i < self.afterSaleModel.imgs.count; i ++) {
            UIImageView * BeautyFood_ui_imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, witdh, witdh)];
            [whiteView addSubview:BeautyFood_ui_imageView];
            BeautyFood_ui_imageView.left = 0 + witdh * (i%4) + inset * (i%4) + 24;
            BeautyFood_ui_imageView.top = temp_top + witdh * (i/4) + inset * (i/4) + 24;
            BeautyFood_ui_imageView.userInteractionEnabled = YES;
            BeautyFood_ui_imageView.contentMode = UIViewContentModeScaleAspectFill;
            BeautyFood_ui_imageView.clipsToBounds = YES;
            BeautyFood_ui_imageView.tag = 10000 + i;
            [BeautyFood_ui_imageView sd_setImageWithURL:self.afterSaleModel.imgs[i]];
            UITapGestureRecognizer * tap = [UITapGestureRecognizer.alloc initWithTarget:self action:@selector(onSlectedImage:)];
            [BeautyFood_ui_imageView addGestureRecognizer:tap];
            whiteView.height = BeautyFood_ui_imageView.bottom + 10;
            [self.imageArray addObject:BeautyFood_ui_imageView];
        }
        
        top = whiteView.bottom + 20;
    });
    
    ({
        UIView * whiteView = [[UIView alloc] initWithFrame:CGRectMake(12, top, STONEOBS_UI_UISCREEN_WIDTH - 24, 156)];
        whiteView.backgroundColor = UIColor.whiteColor;
        whiteView.layer.cornerRadius = 8;
        whiteView.clipsToBounds = YES;
        [footer addSubview:whiteView];
        
        STButton * BeautyFood_ui_button = [[STButton alloc] initWithFrame:CGRectMake(12, 0, 200, 40)
                                                                  title:@"售后进度"
                                                             titleColor:STONEOBS_UI_FIRST_TEXT_COLOR
                                                              titleFont:14
                                                           cornerRadius:0
                                                        backgroundColor:nil
                                                        backgroundImage:nil
                                                                  image:[UIImage imageNamed:@"shjd"]];
        [whiteView addSubview:BeautyFood_ui_button];
        whiteView.userInteractionEnabled = YES;
        BeautyFood_ui_button.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
        CGFloat witdh = whiteView.width - 42 - 10;
        CGFloat temptop = BeautyFood_ui_button.bottom + 10;
        CGFloat first_top = 0;
        CGFloat first_bootom = 0;
        CGFloat center_x = 0;
        NSInteger count = self.afterSaleModel.streams.count;
        NSInteger i = 0;
        
        for (BFShAfterSaleModelStreamsModel * statusModel in self.afterSaleModel.streams) {
            ({
                UIView * view = [self viewFormModel:statusModel witdh:witdh];
                [whiteView addSubview:view];
                view.top = temptop;
                temptop = view.bottom;
                

                
                UIImageView * BeautyFood_ui_imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 10, 10)];
                BeautyFood_ui_imageView.image = [UIImage imageNamed:@"pt"];
                [whiteView addSubview:BeautyFood_ui_imageView];
                BeautyFood_ui_imageView.top = view.top;
                BeautyFood_ui_imageView.centerX = view.left/2;
                center_x = BeautyFood_ui_imageView.centerX;
                if (i == 0) {
                    first_top = BeautyFood_ui_imageView.centerY;
                }
                if (i == (count-1)) {
                    first_bootom = BeautyFood_ui_imageView.centerY;
                }
                i ++;
            });
        }
     
        UIView * BeautyFood_ui_line = [[UIView alloc] initWithFrame:CGRectMake(0, first_top, 1, first_bootom - first_top)];
        BeautyFood_ui_line.backgroundColor = WH_UICOLOR_FROM_RGBA(0xF5F5F5);
        BeautyFood_ui_line.centerX = center_x;
        [whiteView insertSubview:BeautyFood_ui_line atIndex:0];
        
        whiteView.height = temptop;
        top = whiteView.bottom ;
        
    });
    footer.height = top + 20;
    self.tableView.tableFooterView = footer;
}
- (UIView*)viewFormModel:(BFShAfterSaleModelStreamsModel*)model witdh:(CGFloat)witdh{
    UIView * view = [[UIView alloc] initWithFrame:CGRectMake(42, 0, witdh, 0)];
    CGFloat top = 0;
    ({
        STLabel * BeautyFood_ui_label = [[STLabel alloc] initWithFrame:CGRectMake(0, 0, witdh, 30)
                                                                text:model.value
                                                           textColor:STONEOBS_UI_SECEND_TEXT_COLOR
                                                                font:13
                                                         isSizetoFit:NO
                                                       textAlignment:NSTextAlignmentLeft];
        [NSString stoneobs_fun_lableAutoAdjustheightWithLabel:BeautyFood_ui_label];
        [view addSubview:BeautyFood_ui_label];
        top = BeautyFood_ui_label.bottom + 10;
    });

    ({
        STLabel * BeautyFood_ui_label = [[STLabel alloc] initWithFrame:CGRectMake(0, top, witdh, 30)
                                                                text:model.time
                                                           textColor:STONEOBS_UI_THIRD_TEXT_COLOR
                                                                font:10
                                                         isSizetoFit:NO
                                                       textAlignment:NSTextAlignmentLeft];
        [NSString stoneobs_fun_lableAutoAdjustheightWithLabel:BeautyFood_ui_label];
        [view addSubview:BeautyFood_ui_label];
        top = BeautyFood_ui_label.bottom + 10;
    });
    
    if (model.status.intValue == 3 && model == self.afterSaleModel.streams.lastObject) {
        //配置物流号
        
        ({
            STLabel * BeautyFood_ui_label = [[STLabel alloc] initWithFrame:CGRectMake(0, top, witdh, 30)
                                                                    text:@"请输入您退货/换货 发出的快递单号"
                                                               textColor:FlatRed
                                                                    font:10
                                                             isSizetoFit:NO
                                                           textAlignment:NSTextAlignmentLeft];
            [NSString stoneobs_fun_lableAutoAdjustheightWithLabel:BeautyFood_ui_label];
            [view addSubview:BeautyFood_ui_label];
            top = BeautyFood_ui_label.bottom + 10;
        });
        
        UITextField * textFiled = [[UITextField alloc] initWithFrame:CGRectMake(0, top + 10, witdh - 100, 28)];
        textFiled.placeholder = @"快递单号";
        [textFiled stbw_setBorderWith:1 borderColor:STONEOBS_UI_THIRD_TEXT_COLOR cornerRadius:2];
        [view addSubview:textFiled];
        top = textFiled.bottom + 10;
        [textFiled stoneobs_fun_setstoneobs_fun_st_leftView:[UIView.alloc initWithFrame:CGRectMake(0, 0, 10, 1)]];
        self.postTextFiled = textFiled;
        __weak typeof(self) weakSelf =  self;
        STButton * BeautyFood_ui_button = [[STButton alloc] initWithFrame:CGRectMake(0, 0, 80, 28)
                                                                  title:@"发货"
                                                             titleColor:UIColor.whiteColor
                                                              titleFont:15
                                                           cornerRadius:14
                                                        backgroundColor:STONEOBS_UI_THEME_BACKGROUNDCOLOR
                                                        backgroundImage:nil
                                                                  image:nil];
        BeautyFood_ui_button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
        BeautyFood_ui_button.bottom = BFShOrderFooterView.stoneobs_ui_cell_height - 15;
        BeautyFood_ui_button.right = STONEOBS_UI_UISCREEN_WIDTH-24 - 0;
//        BeautyFood_ui_button.userInteractionEnabled = NO;
        [view addSubview:BeautyFood_ui_button];
        BeautyFood_ui_button.centerY = textFiled.centerY;
        BeautyFood_ui_button.right = view.width;
        [BeautyFood_ui_button setClicAction:^(UIButton *sender) {
            [weakSelf on_slected_post_button];
        }];
        view.userInteractionEnabled = YES;
    }
    
    view.height = top + 30;
    return view;
}
- (UIView*)viewFormDealModel:(NSObject*)model witdh:(CGFloat)witdh{
    UIView * view = [[UIView alloc] initWithFrame:CGRectMake(42, 0, witdh, 0)];
    CGFloat top = 0;
    ({
        STLabel * BeautyFood_ui_label = [[STLabel alloc] initWithFrame:CGRectMake(0, 0, witdh, 30)
                                                                text:self.afterSaleModel.cus_status
                                                           textColor:STONEOBS_UI_SECEND_TEXT_COLOR
                                                                font:13
                                                         isSizetoFit:NO
                                                       textAlignment:NSTextAlignmentLeft];

        [NSString stoneobs_fun_lableAutoAdjustheightWithLabel:BeautyFood_ui_label];
        [view addSubview:BeautyFood_ui_label];
        top = BeautyFood_ui_label.bottom + 10;
    });
    ({
        STLabel * BeautyFood_ui_label = [[STLabel alloc] initWithFrame:CGRectMake(0, top, witdh, 30)
                                                                text:self.afterSaleModel.sale_user_reason
                                                           textColor:STONEOBS_UI_SECEND_TEXT_COLOR
                                                                font:12
                                                         isSizetoFit:NO
                                                       textAlignment:NSTextAlignmentLeft];
        [NSString stoneobs_fun_lableAutoAdjustheightWithLabel:BeautyFood_ui_label];
        [view addSubview:BeautyFood_ui_label];
        top = BeautyFood_ui_label.bottom + 10;
    });
    ({
        STLabel * BeautyFood_ui_label = [[STLabel alloc] initWithFrame:CGRectMake(0, top, witdh, 30)
                                                                text:@"2020-01-21 19:21:05"
                                                           textColor:STONEOBS_UI_THIRD_TEXT_COLOR
                                                                font:10
                                                         isSizetoFit:NO
                                                       textAlignment:NSTextAlignmentLeft];
        [NSString stoneobs_fun_lableAutoAdjustheightWithLabel:BeautyFood_ui_label];
        [view addSubview:BeautyFood_ui_label];
        top = BeautyFood_ui_label.bottom + 10;
    });
    view.height = top + 30;
    return view;
}
#pragma --mark UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return self.dataSouce.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return BFShOrderHeaderView.stoneobs_ui_cell_height;
}
- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    BFShOrderHeaderView * header = [tableView dequeueReusableHeaderFooterViewWithIdentifier:@"BFShOrderHeaderView"];
    BFShOrderModel * model = self.dataSouce[section];
    header.model = model;
    __weak typeof(self) weakSelf =  self;
    UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id  _Nonnull sender) {
        [weakSelf tableView:tableView didSelectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:section]];
    }];
    [header addGestureRecognizer:tap];
    header.userInteractionEnabled = YES;
//    header.status_lable.hidden = YES;
    return header;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return BFShOrderTableViewCell.stoneobs_ui_cell_height;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    
    return BFShOrderFooterView.stoneobs_ui_cell_height;
}
- (UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    BFShOrderFooterView * footer = [tableView dequeueReusableHeaderFooterViewWithIdentifier:@"BFShOrderFooterView"];
    BFShOrderModel * model = self.dataSouce[section];
    footer.model = model;
    __weak typeof(self) weakSelf =  self;
    UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id  _Nonnull sender) {
        [weakSelf tableView:tableView didSelectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:section]];
    }];
    [footer addGestureRecognizer:tap];
    footer.userInteractionEnabled = YES;
    [footer clear_all_menu_button];
    
    STButton * BeautyFood_ui_button = [[STButton alloc] initWithFrame:CGRectMake(0, 0, 80, 28)
                                                              title:@"查看订单"
                                                         titleColor:UIColor.whiteColor
                                                          titleFont:15
                                                       cornerRadius:14
                                                    backgroundColor:STONEOBS_UI_THEME_BACKGROUNDCOLOR
                                                    backgroundImage:nil
                                                              image:nil];
    BeautyFood_ui_button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    BeautyFood_ui_button.bottom = BFShOrderFooterView.stoneobs_ui_cell_height - 15;
    BeautyFood_ui_button.right = STONEOBS_UI_UISCREEN_WIDTH-24 - 0;
    BeautyFood_ui_button.userInteractionEnabled = NO;
    [footer addSubview:BeautyFood_ui_button];
    return footer;
}

- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString * reuseIdentifier =  @"cell";
    BFShOrderTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
    if (!cell) {
        cell = [[BFShOrderTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
        
    }
    BFShOrderModel * model = self.dataSouce[indexPath.section];
    cell.model = model;
    return cell;
}
#pragma --mark UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    BFShOrderModel * model = self.dataSouce[indexPath.section];
    BFShOrderDetailViewController * vc = BFShOrderDetailViewController.new;
    vc.o_id = model.o_id;
    [self pushViewController:vc animated:1];
    [self.tableView deselectRowAtIndexPath:indexPath animated:NO];
}
#pragma mark --stoneobs Action Method
- (void)on_slected_post_button{
    if (!self.postTextFiled.text.length) {
        [SVProgressHUD showErrorWithStatus:@"请输入快递单号"];
        return;
    }
    [self send_post_request];
}
- (void)onSlectedImage:(UITapGestureRecognizer*)tap{
    NSMutableArray * models = [NSMutableArray new];
    for (UIImageView * imageView in self.imageArray) {
        STBWPhotoModel * model = [STBWPhotoModel  new];
        model.originImage = imageView.image;
        [models addObject:model];
    }
    STBWBrowserViewController * vc = [[STBWBrowserViewController alloc] initWithArray:models curentIndex:tap.view.tag-10000];
    vc.shouldHideBottomView = YES;
    vc.shouldHideTopView = YES;
    vc.delegate = self;
    UIViewController * rootVC = TMUtils.stoneobs_fun_get_currentTopController;
    [rootVC presentViewController:vc animated:NO completion:nil];
}

#pragma mark --STBWBrowserViewControllerDelegate
- (UIView*)browserControllerDidScrollToIndexpath:(NSIndexPath *)indexPath model:(STBWPhotoModel *)model controller:(STBWBrowserViewController *)controller{
    NSIndexPath * createIndex = [NSIndexPath indexPathForRow:indexPath.row inSection:0];//多一个加号
    return   self.imageArray[createIndex.row];
}
- (void)rightBarActionFromController:(STBWBrowserViewController *)controller currentIndexPath:(NSIndexPath *)curentIndexpath{

}

#pragma mark --BeautyFood_net netWork Method
- (void)send_after_sale_detail_request{
    [SVProgressHUD showWithStatus:@"请稍后"];
    NSMutableDictionary * BeautyFood_net_param_dic = [NSMutableDictionary new];
    NSString * BeautyFood_net_user_id = [STTools_UserManger defult].stoneobs_fun_get_loginedUser.uid.description;
    NSString * BeautyFood_net_user_token = STTools_UserManger.defult.stoneobs_fun_get_loginedUser.token;
    if (BeautyFood_net_user_id.length) {
        [BeautyFood_net_param_dic setObject:BeautyFood_net_user_id forKey:@"uid"];
    }
    if (BeautyFood_net_user_token.length) {
        [BeautyFood_net_param_dic setObject:BeautyFood_net_user_token forKey:@"token"];
    }
    if (self.model.o_id.length) {
        [BeautyFood_net_param_dic setObject:self.model.o_id forKey:@"id"];
    }
    NSString * BeautyFood_net_net_url = [NSString stringWithFormat:@"%@%@",RELEASE_SERVER_URL_HEADER,@"v1/orders/forSaleDetail"];
    DDLogInfo(@"url:%@",BeautyFood_net_net_url);
    DDLogInfo(@"param:%@",BeautyFood_net_param_dic);
    [[STTools_NetWrokManger defaultClient] stoneobs_fun_requestWithPath:BeautyFood_net_net_url
                                                                 method:STHttpRequestType_stoneobs_enumGet
                                                             parameters:BeautyFood_net_param_dic
                                                                success:^(NSURLSessionDataTask *operation, id responseObject) {
        [SVProgressHUD dismiss];
        NSDictionary * BeautyFood_net_model_dic = [responseObject valueForKey:@"data"];
        BFShAfterSaleModel * model = [BFShAfterSaleModel mj_objectWithKeyValues:BeautyFood_net_model_dic];
        self.afterSaleModel = model;
        self.dataSouce = @[self.model].mutableCopy;
        [self.tableView reloadData];
        [self BeautyFood_ui_configSubView];
        [self config_tableFooter];
        
        // DDLogInfo(@"json = \n%@",modelDic.mj_JSONString);
        DDLogInfo(@"%@请求成功:resp\n%@",BeautyFood_net_net_url,responseObject);
        
        
    } failure:^(NSString *stateCode, STTools_Error *error,NSError *originError) {
        [SVProgressHUD dismiss];
        [SVProgressHUD showErrorWithStatus:error.desc];
        DDLogError(@"\n请求失败:\nurl:%@\nparam:%@\n失败原因:%@\n错误码:%ld",
                   BeautyFood_net_net_url,BeautyFood_net_param_dic,error.desc,error.code);
    }];
}
- (void)send_post_request{
    [SVProgressHUD showWithStatus:@"请稍后"];
    NSMutableDictionary * BeautyFood_net_param_dic = [NSMutableDictionary new];
    NSString * BeautyFood_net_user_id = [STTools_UserManger defult].stoneobs_fun_get_loginedUser.uid.description;
    NSString * BeautyFood_net_user_token = STTools_UserManger.defult.stoneobs_fun_get_loginedUser.token;
    if (BeautyFood_net_user_id.length) {
        [BeautyFood_net_param_dic setObject:BeautyFood_net_user_id forKey:@"uid"];
    }
    if (BeautyFood_net_user_token.length) {
        [BeautyFood_net_param_dic setObject:BeautyFood_net_user_token forKey:@"token"];
    }
    if (self.postTextFiled.text.length) {
        [BeautyFood_net_param_dic setObject:self.postTextFiled.text forKey:@"nu_code"];
    }
    [BeautyFood_net_param_dic setObject:self.afterSaleModel.af_id forKey:@"id"];
    
    NSString * BeautyFood_net_net_url = [NSString stringWithFormat:@"%@%@",RELEASE_SERVER_URL_HEADER,@"v1/orders/orderAfterSale"];
    DDLogInfo(@"url:%@",BeautyFood_net_net_url);
    DDLogInfo(@"param:%@",BeautyFood_net_param_dic);
    [[STTools_NetWrokManger defaultClient] stoneobs_fun_requestWithPath:BeautyFood_net_net_url
                                                                 method:STHttpRequestType_stoneobs_enumPost
                                                             parameters:BeautyFood_net_param_dic
                                                                success:^(NSURLSessionDataTask *operation, id responseObject) {
        [SVProgressHUD dismiss];
        [SVProgressHUD showSuccessWithStatus:@"发货成功"];
        [self send_after_sale_detail_request];
        
        // DDLogInfo(@"json = \n%@",modelDic.mj_JSONString);
        DDLogInfo(@"%@请求成功:resp\n%@",BeautyFood_net_net_url,responseObject);
        
        
    } failure:^(NSString *stateCode, STTools_Error *error,NSError *originError) {
        [SVProgressHUD dismiss];
        [SVProgressHUD showErrorWithStatus:error.desc];
        DDLogError(@"\n请求失败:\nurl:%@\nparam:%@\n失败原因:%@\n错误码:%ld",
                   BeautyFood_net_net_url,BeautyFood_net_param_dic,error.desc,error.code);
    }];
}
@end
